<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>提交订单-蚂蚁街</title>
<link href="__APP__/statics/css/style.css" rel="stylesheet" type="text/css"  charset="utf-8"/>
<script type="text/javascript" charset="utf-8">window.GROUP= "__GROUP__";window.APP= "__APP__";window.URL= "__URL__";</script>
<style>
*{margin:0;padding:0;list-style-type:none;}
a,img{border:0;}
body{font-family:"微软雅黑",Arial,Lucida,Verdana,Helvetica,sans-serif;font-size:12px;color:#333;line-height:150%;background:#fff;}
a:link,a:visited{color:#333;text-decoration:none;}
a:hover{color:#317ee7;}
a:active{color:#900;}
li{list-style:none}
.login{width:960px;margin:0 auto;margin-top:50px;}
.login .left{width:450px;float:left;}
.login .right{border:1px solid #C0C0C0;width:270px;float:right;overflow:hidden;padding:30px;}

.order {padding:5px;width:950px;margin:0 auto;margin-top:50px;border:5px solid #317ee7;}
.m_addr{width:940px;height:100%;margin:0 auto;margin-top:10px;font-size:13px;padding:5px;}
.m_addr:hover{height:100%;border:0px solid;background-color:#F2F7FF;}
.m_addr h4{font-size:14px;}
.m_addr h3{font-size:20px;}
.m_addr span{color:#FF5500;font-weight:bold;}
.m_addr li{list-style:none}
.send{width:200px;margin-top:20px;margin:0 auto;float:right;}
a{text-decoration:none}

.catt a {border:#c8c9cd 1px solid;text-align:center;background-color:#fff;margin-left:5px;margin-top:6px;padding-left:10px;padding-right:10px;display:block;white-space:nowrap;color:#000;text-decoration:none;float:left;padding:10px;}
.catt a:hover {border:#ff6701 2px solid;margin:-1px;margin-left:4px;margin-top:5px;}
.catt a:focus {outline-style:none;}
.catt .cattsel {border:#ff6701 2px solid;margin:-1px;background:url("__APP__/statics/choose_bg.jpg") no-repeat bottom right;margin-left:4px;margin-top:5px;}
.cattsel {font-size:16px;font-weight:bold;color:#ff6701;background-color:#ff6701;}
.catt .cattsel a:hover {border:#ff6701 2px solid;margin:-1px;background:url("__APP__/statics/choose_bg.jpg") no-repeat bottom right;}
.catt{font-size:16px;}
.catt input{display:none;}
/*优惠券展开*/
#youhui{width:600px;margin:0 auto;display: none;float:left;background-color: #EEEEEE;z-index:999}
#lipin{width:600px;margin:0 auto;display: none;float:left;background-color: #EEEEEE;z-index:999}
.slide {width:100px;margin:0 auto;background: url("__APP__/statics/btn-slide.gif") no-repeat center top;float:left;z-index:999}
.btn-slide {background: url("__APP__/statics/white-arrow.gif") no-repeat right -50px;text-align: center;width: 100px;height: 20px;padding: 10px 10px 0 0;margin: 0 auto;display: block;float:left;font: bold 100%/100% Arial, Helvetica, sans-serif;color: #fff;z-index:999}
.active {background-position: right 12px;}
#youhui input{padding:2px;}

#sending{text-align:center;border:0;width:100%;height:40px;position:fixed;left:0px;top:40%;z-index:999;padding:5px;height:100px;display:none}
</style>
<script src="__APP__/statics/jquery-1.9.1.min.js"></script>
</head>
<body>
<div id="sending"><img src="__APP__/statics/sending.gif"></div>
<if condition="$islogin eq '1'">
<!--判断是否登录-->
<script src="__APP__/statics/js/login.js"></script>
<link href="__APP__/statics/css/login.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
$(document).ready(function(){
		$.webox({
			height:380,
			width:400,
			bgvisibel:true,
			title:'会员登录',
			iframe:'__GROUP__/Member/slogin.html?'+Math.random
		});
})
</script>
</if>


<div class="top" style="width:1000px;margin:0 auto;margin-top:20px;"><a href="http://www.mayijie.com"><img src="__APP__/statics/logo-201305.png"></a></div>

<form method="POST" action="javascript:;">
<div class="order">

   <div class="m_addr">
   <h3>确认收货地址</h3><br>
       <ul class="catt">
<volist name="addr" id="addr"><if condition="$addr.address neq ''">
        <a  onclick="changeAddr(this)" href="javascript:;">{$addr.address}&nbsp;&nbsp;({$addr.name}&nbsp;&nbsp;收)&nbsp;&nbsp;{$addr.mobile}<input  name="old_addr" type="radio" value="{$addr.addr_id}"/></a><div style="clear:both"></div>
</if></volist>
        <a  id="new_addr" onclick="changeAddr(this)" href="javascript:;">使用新地址<input type="radio" name="old_addr" id="m_addr" value="no"></a>
       </ul>
	   <div style="clear:both"></div>
	   <ul id="newaddr"></ul>
   </div>

   <div style="clear:both"></div>
   
   <div class="m_addr"><h3>配送方式</h3>
     <div class="catt" id="express">
<volist name="ship" id="ship">
	     <a style="width:150px;" onclick="changeShip(this)" href="javascript:;">{$ship.ex_name}<input  name="shipping" type="radio" value="{$ship.id}"/></a>
</volist>
	 </div>
   <div style="clear:both"></div>
   </div>
   
   
   <div class="m_addr"><h3>支付方式</h3>
      <ul class="catt">
<volist name="pay" id="pay">
	  <a style="width:150px;" onclick="getpay(this)" href="javascript:;">{$pay.pay_name}<input  name="pay" type="radio" value="{$pay.id}" /></a>
</volist>
	  </ul>
	  <div style="clear:both"></div>
	  <ul id="payment"></ul>
	  <div style="clear:both"></div>
   </div>
   
   
   <div class="m_addr">
         <h3>商品信息</h3>
         <table border="0" width="940" style="border-collapse: collapse" cellspacing="2" height="58">
			<tr bgcolor="#E2E8EB">
				<td align="center" height="30"><h4>图片</h4></td>
				<td align="center" height="30" width="630"><h4>商品名称</h4></td>
				<td align="center" height="30"><h4>单价</h4></td>
				<td align="center" height="30"><h4>数量</h4></td>
				<td align="center" height="30"><h4>小计</h4></td>
			</tr>
<volist name="cart" id="cart">
			<tr bgcolor="#FAFCFF">
				<td align="center"><if condition="$cart.s_pic eq '' "><img src="__APP__/statics/none.gif"/><else/><img src="__APP__/{$cart.s_pic}" width="60px" height="60px"/></if></td>
				<td align="left"><a href="__APP__/Goods/item/id/{$cart.goods_id}" target="_blank">{$cart.name}</a><br><span>{$cart.props}</span></td>
				<td align="center">{$cart.price}</td>
				<td align="center">{$cart.product_num}</td>
				<td align="center" style="color:#FF5500;font-weight:bold;">{$cart.s_money}</td>
			</tr>
</volist>
		</table>
		<a href="__GROUP__/Cart/show">>>修改商品</a>
   </div>
   <!--订单END-->
   

   <div class="m_addr">
          <table border="0" width="940" cellpadding="5"  cellspacing="5" bgcolor="#F2F7FF">
			<tr>
				<td width="7%">　</td>
				<td width="54%" rowspan="4"><textarea rows="2" name="cus_bb" cols="70"></textarea></td>
				<td align="right" width="13%">商品总额：</td>
				<td align="left" width="16%">￥<span id="good_price">{$total_money}</span></td>
			</tr>
			<tr>
				<td width="10%">订单留言：</td>
				<td align="right" width="13%">运费：</td>
				<td align="left" width="16%">￥<span id="dly_price">0</span></td>
			</tr>
			<tr>
				<td width="7%">　</td>
				<td align="right" width="13%">优惠金额：</td>
				<td align="left" width="16%">￥<span id="pmt_price">0.00</span></td>
			</tr>
			<tr>
				<td width="7%">　</td>
				<td align="right" width="13%">礼品卡抵扣：</td>
				<td align="left" width="16%">￥<span id="lp_price">0.00</span></td>
			</tr>
			<tr>
<!--优惠券、礼品卡-->
				<td width="65%" colspan="2" height="109" rowspan="3" valign="top">
				<div style="width:600px">
                    <div class="slide"><a class="btn-slide" id="yh">优惠券</a></div>
					<div id="youhui">
						<div style="border:1px solid #dedede;padding:10px">
						   A您当前可用优惠券(单个订单只能使用一张)：<br><br>
						  <ul>
						   <li><input type="radio" value="none" name="coupons" checked>不使用优惠</li>
<volist name="coupons" id="coupons">
                           <li><input type="radio" value="{$coupons.passcode}" name="coupons">
						   {$coupons.cou_id}&nbsp;&nbsp;面额：<span>￥{$coupons.cou_amount}</span>&nbsp;&nbsp;
						   有效期：<span>{$coupons.begin_time|date="Y-m-d",###}</span>至<span>{$coupons.end_time|date="Y-m-d",###}</span>
						   </li>
</volist>              
                           <li id="xuni"></li>
                         </ul>
						 <input type="text" id="pmt" value="0" style="display:none">
						 B使用实体优惠券：<br><br>
						 <ul id="shiti">
						 <input type="text" id="code1" name="code[]" size="3" maxlength=4>-
						 <input type="text" id="code2" name="code[]" size="3" maxlength=4>-
						 <input type="text" id="code3" name="code[]" size="3" maxlength=4>-
						 <input type="text" id="code4" name="code[]" size="3" maxlength=4>
						 <input type="button" id="ckcou" value="使用" style="border:0px;color:#fff;padding:3px;font-weight:bold;background:#ff5500">
						 <span id="tixing"></span>
						 </ul>
						</div>
					</div>
				</div>

                <div style="clear:both;"></div>

				<div style="margin-top:5px;">
					<div class="slide"><a class="btn-slide" id="lp">礼品卡</a></div>
					<div id="lipin">
					<div style="border:1px solid #dedede;padding:10px">
					    <input type="radio" onclick="usewallet()" value="0.00" name="wallet" checked>不使用礼品卡<br>
						<input type="radio" onclick="usewallet()" value="{$member.wallet}" name="wallet">礼品卡可用余额：￥<span>{$member.wallet}</span>
						<span style="margin-left:10px"><a href="__GROUP__/Member/wallet">充值</a></span>
					</div>
					</div>
				</div>
<!--优惠券、礼品卡end-->
				</td>
				<td align="right" width="13%" height="49" style="font-size:16px;font-weight:bold;">应付金额：</td>
				<td align="left" width="16%" height="49" style="font-size:20px;font-weight:bold;color:#FF5500">￥<span id="total_price"></span></td>
			</tr>
			<tr>
				<td align="right" width="13%" height="30"></td>
				<td align="left" width="16%" height="30"></td>
			</tr>
			<tr>
				<td align="right" width="13%" height="30">发票抬头：<br><br>送货时间：</td>
				<td align="left" width="16%" height="30">
				<input type="text" size="15" name="invoice">
				<br><br>
				<select name="dlytime">
<volist name="dlytime" id="dlytime">
				<option value="{$dlytime.time}">{$dlytime.time}
</volist>
               </select>
                </td>
			</tr>
		</table>
	</div>   
   <div class="send"><input id="send" type="image" src="__APP__/statics/btn-confirm.gif"></div>
   <div style="clear:both"></div>

</div>
<!--class:order  end-->
<input type="text" style="display:none" value="{$total_weight}" id="total_weight">

<div style="display:none" id="copy">
<ul id="shiti">
 <input type="text" id="code1" name="code[]" size="3" maxlength=4 value="1307">-
 <input type="text" id="code2" name="code[]" size="3" maxlength=4 value="N34M">-
 <input type="text" id="code3" name="code[]" size="3" maxlength=4 value="64F7">-
 <input type="text" id="code4" name="code[]" size="3" maxlength=4 value="4Q3E">
 <input type="button" id="ckcou" value="使用" style="border:0px;color:#fff;padding:3px;font-weight:bold;background:#ff5500">
 </ul>
</div>
</form>
<script type="text/javascript">
//使用优惠券
$("[name=coupons]").click(function(){
     var code=$(this).val();
     $.ajax({
	       type:"POST",
		   url:URL+"/get_coupons",
		   dataType:"json",
		   data:{'code':code},
		   success:function(data){
		      $("#pmt").val(data);
			  $("#pmt_price").html('-'+parseFloat(data).toFixed(2));
			  countPay();
			  $("#xuni").html('');
			  $("#tixing").html('');
		   }
	   })
})

//使用礼品卡
function usewallet(){
   var good_price=parseFloat($("#good_price").text());
   var ship_price=parseFloat($("#dly_price").text());
   var pmt_price=parseFloat($("#pmt").val());
   var total=parseFloat(good_price+ship_price-pmt_price);

   var act_amout=parseFloat($("[name=wallet]:checked").val()).toFixed(2);
	//alert(act_amout);
	if((total*1.0)>act_amout){
	   $("#lp_price").html(act_amout);
	}else{
	   $("#lp_price").html(total);
	}
	countPay();
}

$("#test").click(function(){
  //$('<input type="radio" value="none" name="coupons" checked>').appendTo($("#xuni"));
   //alert($("[name=coupons]:checked").val());
   //countPay();
   countPay();
   $("#sending").css("display","block");
})

$(document).ready(function(){
	$("#yh").click(function(){
		$("#youhui").slideToggle("slow");
		if($("#lipin").css("display")=='block'){
		    $("#lipin").slideToggle("slow");
		}
		$(this).toggleClass("active"); return false;
	});

	$("#lp").click(function(){
		$("#lipin").slideToggle("slow");
		if($("#youhui").css("display")=='block'){
		   $("#youhui").slideToggle("slow");
		}
		$(this).toggleClass("active"); return false;
	});

	$("#code1").bind("keyup",function(){
	   if($(this).val().length==4){$("#code2").focus();}
	})
	$("#code2").bind("keyup",function(){
	   if($(this).val().length==4){$("#code3").focus();}
	})
	$("#code3").bind("keyup",function(){
	   if($(this).val().length==4){$("#code4").focus();}
	})

	$("#ckcou").click(function(){
	     var code=$("#code1").val()+$("#code2").val()+$("#code3").val()+$("#code4").val();
		 if(code.length!=16){
		    alert("请输入完整！");
		 }else{
		    $.ajax({
				   type:"POST",
				   url:URL+"/ck_coupons",
				   dataType:"json",
				   data:{'code':code},
				   success:function(data){
						if(data.result=='true'){
						   var nu=data.money;
						   $("[name=coupons]").each(function(){
							  $(this).attr('checked',false);
							})
						   $('<input type="radio" value="'+data.code+'" style="display:none" name="coupons" checked>').appendTo($("#xuni"));
						   $("#pmt").val(nu);
						   $("#pmt_price").html('-'+parseFloat(nu).toFixed(2));
						   $("#tixing").html('恭喜你，验证通过！');
						}else{
						   	jNotify("<strong>此优惠券已失效！</strong>",{VerticalPosition : 'center',HorizontalPosition : 'center'});
						   $("#pmt_price").html('0.00');
						   $("#pmt").val('0');
						}
						countPay();						
				   }
			   })
		  }
	})

});

</script>

<script type="text/javascript" src="__APP__/statics/js/order.js"></script>
<link rel="stylesheet" type="text/css" href="__APP__/statics/css/jNotify.jquery.css" />
<script type="text/javascript" src="__APP__/statics/jNotify.jquery.js"></script>
<include file="Public:footer"/>